/*

(
a = Array.new(10);
a.add(\key1);
a.add(\val1);
a.add(\key2);
a.add(\val2);
ArrayUtils.getValueFromSynthArgs(a, \key2).postln;
ArrayUtils.setValueInSynthArgs(a, \key2, 100).postln;
)





*/




ArrayUtils{

	*getValueFromSynthArgs{|arrayArg, val|
		var lastOneWasIt = false;
		arrayArg.do{|thisVal|
		
			if(lastOneWasIt == true){
				^thisVal;
			};
			
			if(thisVal == val){
				lastOneWasIt = true;	
			}
		};
		^nil;	
	}
	
	*setValueInSynthArgs{|arrayArg, name, val|
		var lastOneWasIt = false;

		(arrayArg.size-1).do{|i|
			if(arrayArg.at(i) == name){
				arrayArg.put(i + 1, val);
				^nil;
			}
		};
		
		arrayArg = arrayArg.addAll([name, val]);
	
	}

}